package com.huatec.controller;


import com.huatec.service.UserService;
import com.huatec.util.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController {
 //注入user Service
    @Resource
    private UserService userService;

         //用户登录
    @RequestMapping(value="/login",method= RequestMethod.POST)
    @ResponseBody
    public Result checkLogin(int sign, String username, String password){
             System.out.println(sign);
             //sign为0，表示教师；sign为1，表示学生
             System.out.println(username);
            System.out.println(password);
             //调用Service层方法
            Result result=userService.checkLogin(sign,username, password);
            //返回结果信息
            return result;
    }
 }

